import {
  Toast
} from "vant";
import cTitle from "components/title";
import {
  scrollMixin
} from "../../../utils/mixin";
export default {
  mixins: [scrollMixin], //加载更多
  data() {
    return {
      list: [
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // },
        // {
        //     avatar:"https://shops.cg500.com/static/upload/images/63/2024/05/6763d5d6f6e4b271a09e4b99d7cc0bcb.jpg",
        //     all_yeji:0,
        //     mobile: "17614108452",
        //     nickname: "微信用户",
        //     uid:54472
        // }
      ],
      text: '',
      // page: 1,//分页 当前页数
      // pageCount: 1,//分页  总页数
      isLoadMore: true,
      page: 1,
      total_page: 0,
    };
  },

  components: {
    cTitle
  },
  // mounted() {
  //   if (!localStorage.getItem("uid")) {
  //     this.$router.push(this.fun.getUrl("member"));
  //     return
  //   }
  //   this.getList();
  // },
  activated() {
    console.log('active')
    if (!localStorage.getItem("uid")) {
      this.$router.push(this.fun.getUrl("member"));
      return
    }
    this.getList();
  },
  computed: {

  },
  methods: {
    openPicker() {
      this.pickerShow = true;
    },
    getList() {
      $http.get("ZhengChengYc.huoban_list", {
        uid: localStorage.getItem("uid"),
        page: this.page,
        text: this.text
      }, "加载中").then((res) => {
        if (res.result == 1) {
          console.log(res, 'shuju_list')
          var nextPageData = res.data.data;
          this.list = [...this.list, ...nextPageData];
          this.total_page = res.data.last_page;
          this.isLoadMore = true;

        } else {
          this.isLoadMore = false;
        }
      });
    },
    checkList() {
      this.page = 1;
      this.list = [];
      this.getList();
    },
    nameinput(e) {},
    //获取更多数据
    getMoreData() {
      console.log("hongbao", this.isLoadMore);
      if (!this.isLoadMore) return;
      this.isLoadMore = false; // 防止多次请求分页数据
      if (this.page >= this.total_page) {
        Toast('到底了')
        return;
      } else {
        this.page += 1;
        this.getList();
      }
    },
    partnerDetails(uid) {
      this.$router.push(this.fun.getUrl("yunTeamPerformance", {
        id: 2,
        uid: uid
      }));
    }
  }
};